package com.guinea.core.web;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.guinea.core.utils.StringUtils;

public class BackLoginAction extends Action {

	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		String username = request.getParameter("u");
		String password = request.getParameter("p");
		if(StringUtils.isBlank(username) || StringUtils.isBlank(password)){
			return new ActionForward("/login.jsp?error=1",true);
		}else{
			return new ActionForward("/j_acegi_security_check?j_username="+username+"&j_password="+password,true);
		}
	}
	
}
